/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TelaInicial.java
 *
 * Created on 23/06/2010, 19:30:52
 */
package gui;

import controller.BolaoFacade;

/**
 * Interface Inicial do Sistema
 * @author Claudio Cardoso, Daniel Leite, Lucas Sampaio, Matheus Sampaio
 * @version 1.0
 */
public class InterfaceInicial extends javax.swing.JFrame {

    /**
	 * 
	 */
	private static final long serialVersionUID = -814249495062018503L;
	
	private BolaoFacade bolaoFacade = new BolaoFacade();
	
	/** Creates new form TelaInicial */
    public InterfaceInicial() {
        initComponents();
        setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        perguntaLogin = new java.awt.Label();
        perguntaCadastro = new java.awt.Label();
        botaoSouCadastrado = new javax.swing.JButton();
        botaoFazerCadastro = new javax.swing.JButton();
        sairSO = new javax.swing.JButton();
        creditos = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Bolão da Copa P2");

        perguntaLogin.setText("Já é cadastrado ?");

        perguntaCadastro.setText("Ainda não criou sua conta ?");

        botaoSouCadastrado.setText("Já sou cadastrado");
        botaoSouCadastrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoSouCadastradoActionPerformed(evt);
            }
        });

        botaoFazerCadastro.setText("Cadastre-se");
        botaoFazerCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoFazerCadastroActionPerformed(evt);
            }
        });

        sairSO.setText("Sair");
        sairSO.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sairSOActionPerformed(evt);
            }
        });

        creditos.setText("Créditos");
        creditos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                creditosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(creditos)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 186, Short.MAX_VALUE)
                .addComponent(sairSO)
                .addGap(20, 20, 20))
            .addGroup(layout.createSequentialGroup()
                .addGap(98, 98, 98)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(perguntaCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(perguntaLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botaoFazerCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botaoSouCadastrado))
                .addContainerGap(86, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(perguntaLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(botaoSouCadastrado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(perguntaCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(botaoFazerCadastro)
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(creditos)
                    .addComponent(sairSO))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botaoSouCadastradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSouCadastradoActionPerformed
        new InterfaceFazerLogin().setVisible(true);
        dispose();
    }//GEN-LAST:event_botaoSouCadastradoActionPerformed

    private void botaoFazerCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoFazerCadastroActionPerformed
        new InterfaceFazerCadastro().setVisible(true);
        dispose();
    }//GEN-LAST:event_botaoFazerCadastroActionPerformed

    private void sairSOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sairSOActionPerformed
    	bolaoFacade.atualizaDados();
    	dispose();
    }//GEN-LAST:event_sairSOActionPerformed

    private void creditosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_creditosActionPerformed
        new Creditos().setVisible(true);
        dispose();
    }//GEN-LAST:event_creditosActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new InterfaceInicial().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoFazerCadastro;
    private javax.swing.JButton botaoSouCadastrado;
    private javax.swing.JButton creditos;
    private java.awt.Label perguntaCadastro;
    private java.awt.Label perguntaLogin;
    private javax.swing.JButton sairSO;
    // End of variables declaration//GEN-END:variables
}
